/**
 * Created by chensk740 on 2018/1/3.
 */
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewEncapsulation} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {Subject, Observable, BehaviorSubject} from 'rxjs';
import {ImageServeService} from "app/shared/service/image/image-serve.service";

@Component({
  selector: 'third-pic-item',
  templateUrl: './third-pic-item.component.html',
  styleUrls: ['./third-pic-item.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class ThirdPicItemComponent implements OnInit, OnDestroy {
  public ngUnsubscribe: Subject<void> = new Subject<void>();
  @Input()  itemData;
  @Output() onclick= new EventEmitter();
  constructor(
              public route: ActivatedRoute,
              public imgService: ImageServeService,
              private router: Router
  ) {
  }

  /**
   * @description 获取图标
   * @param iconName 图标名
   * @author chensk740
   * @date 2018-1-11
   */
  getIcon(iconName: string) {
    return this.imgService.getIcon(iconName);
  }
  /**
   * @description 跳转到详情
   * @param id 内容id
   * @author chensk740
   * @date 2018-1-11
   */
  goToTarget(article) {
    this.onclick.emit(article);
  }
  ngOnInit() {
  }

  ngOnDestroy() {
    this.ngUnsubscribe.next();
    this.ngUnsubscribe.complete();
  }
}
